Fk:loadTranslationTable{
  ["dajubei__zhidang"] = "制党",
  [":dajubei__zhidang"] = "结束阶段，你可以展示所有手牌并重铸其中所有基本牌，然后执行一个额外的出牌阶段。",
}

local zhidang = fk.CreateSkill{
  name = "dajubei__zhidang",
}

zhidang:addEffect(fk.EventPhaseStart, {
  anim_type = "special",
  can_trigger = function (self, event, target, player, data)
    if player:hasSkill(zhidang.name) and player == target then
      return data.phase == Player.Finish and not player:isKongcheng()
    end
  end,
  on_use = function (self, event, target, player, data)
    if player.dead or player:isKongcheng() then return end
    local room = player.room
    room:showCards(player:getCardIds("h"), player)
    if player.dead then return end
    local to_recast = table.filter(player:getCardIds("h"), function(id)
      return Fk:getCardById(id, true).type == Card.TypeBasic
    end)
    if #to_recast > 0 then
      room:recastCard(to_recast, player, zhidang.name)
    end
    if player.dead then return end
    player:gainAnExtraPhase(Player.Play, zhidang.name, true)
  end
})

return zhidang